﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL.Classes;
using DAL.Help;

public partial class TrangCaNhan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            PopulateControls();
    }
    private void DataNull()
    {
        if (Session["MaTaiKhoan"] == "")
            Response.Redirect("~/DangNhap.aspx");
    }
    private void PopulateControls()
    {
        string accountID = Request.QueryString["TaiKhoanID"] ?? "";
        if (accountID != "")
        {
            TaiKhoan data = TaiKhoan.LayThongTinTheoMaTaiKhoan(accountID);
            if (data != null)
            {
                lbUserName.Text = "Trang Album '" + data.TenDangNhap+"'";
                if ((accountID.CompareTo(Session["MaTaiKhoan"].ToString()) == 0))
                {
                    if (ConvertType.ToInt32(Session["QuyenSuDung"]) == 2)
                        lnkUpload.Visible = false;
                    else
                    {
                        lnkUpload.Visible = true;
                        lnkUpload.NavigateUrl = "~/CapNhatBaiDang.aspx";
                    }
                    lnkSuaMatKhau.Visible = true;
                    lnkSuaThongTinCaNhan.Visible = true;
                    UCBaiDangTheoTaiKhoan21.Visible = false;
                }
                else
                {
                    lnkUpload.Visible = false;
                    lnkSuaMatKhau.Visible = false;
                    lnkSuaThongTinCaNhan.Visible = false;
                    UCBaiDangTheoTaiKhoan1.Visible = false;
                }
            }
            else
                DataNull();
        }
        else
            DataNull();
    }
}
